UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5S3JASerYIH/h8+QlRUkYCMQR4l8dcfU9qO5NbHEZdc=' 
WHERE 
  key_id = '27c8aabb4b5ba6f9c8714fec6e1de7d2308872a2234c1c60e84e53133ecf95e5' 
  AND (
    token = '5S3JASerYIH/h8+QlRUkYCMQR4l8dcfU9qO5NbHEZdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040