UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mkKEwpM637qPDDtmqPdHU6gLXMEd+gjiMvmvfJ7NMyg=' 
WHERE 
  key_id = '6b0a9b82f517cd9339e55c05cfc768d9bf278c7af200a4d7bcc1440139052980' 
  AND (
    token = 'mkKEwpM637qPDDtmqPdHU6gLXMEd+gjiMvmvfJ7NMyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029