UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2y6GKj/r7V5447BlnnT3cgUIsShuiEMnfhs08rj8jas=' 
WHERE 
  key_id = '789b7a4af896a3051a2f9f0eeedab87c1cd67c80d714601bc63a8e6a0c9e665e' 
  AND (
    token = '2y6GKj/r7V5447BlnnT3cgUIsShuiEMnfhs08rj8jas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039