UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xXVlUG38qxIqh6RDO3KtK41DGCw7HFE5JLuyzIWsmkk=' 
WHERE 
  key_id = '49c2f4d27be9a4c19b8e3d70e92a0bce566b7aa017e8ef3ffbd62535812887c5' 
  AND (
    token = 'xXVlUG38qxIqh6RDO3KtK41DGCw7HFE5JLuyzIWsmkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025