UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 300, 
  token = 'OhpB0619BvzF0WoRPuUWcGRPFaacj+IqttrOUBUQw1k=' 
WHERE 
  key_id = '278aa5c65a5f58ad65f9760705a865b72a35972766b78f87635d5eaedc0453b7' 
  AND (
    token = 'OhpB0619BvzF0WoRPuUWcGRPFaacj+IqttrOUBUQw1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034