UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WXF8w585EvcgovpOIBDAa/+sucPu1vItqVTIV9BJvsg=' 
WHERE 
  key_id = 'cd07dee317f5fbb884ba23405e460fd6e4702dec93e4d329ec1ab4021d400d94' 
  AND (
    token = 'WXF8w585EvcgovpOIBDAa/+sucPu1vItqVTIV9BJvsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029