UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mVODsFyIgyJWp1Z0iE0P3xCGN8VUUCYF7C6NAipSnFA=' 
WHERE 
  key_id = '1ff0e6ec6d36ccfa0bde5d3287e67a6ca5a4e417fc1cba33e6ef4fd97ef10546' 
  AND (
    token = 'mVODsFyIgyJWp1Z0iE0P3xCGN8VUUCYF7C6NAipSnFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077