UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P9+gwdmLfF/Ud4zViD11kdBJsGxwPfJ898bjsnm+atU=' 
WHERE 
  key_id = '24fcee96f1815f4692d37c2eb4d78de2575226d9571066b51f0be64d53b3f6e1' 
  AND (
    token = 'P9+gwdmLfF/Ud4zViD11kdBJsGxwPfJ898bjsnm+atU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050