UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RsuDKi96Gl+LHfazVcd4aBrtMJNuSMdT3KrbrEg/9lA=' 
WHERE 
  key_id = '89f02b95bcc3a25df479bdf78ffcdd205b48a571f0d256f01472139023ef06ea' 
  AND (
    token = 'RsuDKi96Gl+LHfazVcd4aBrtMJNuSMdT3KrbrEg/9lA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030