UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fa2RmN2v7xEj0GysR/OWP7l6GiPpDWoWGJ8JedeGMeY=' 
WHERE 
  key_id = '9be138f36d7582f95215276edf7c5445768cabb4e4a1656f429166fdd0783941' 
  AND (
    token = 'Fa2RmN2v7xEj0GysR/OWP7l6GiPpDWoWGJ8JedeGMeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033