UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ef+/3zUTKXg0cqtNEvcWxwaZ30N3uxYQZt6QmVCormc=' 
WHERE 
  key_id = '1f220e0bb395284c279f65d05a50b3888fa421edff989b2d368f3164b4ab4167' 
  AND (
    token = 'Ef+/3zUTKXg0cqtNEvcWxwaZ30N3uxYQZt6QmVCormc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026