UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l8zhklGqXqXQk66JQXCFc1CLN5w8mGGPddQqqj4BR4A=' 
WHERE 
  key_id = '541c4fb05aae4ae1b9a49aa1b736482fba2f376b6a603adb2d645817ea5b7e14' 
  AND (
    token = 'l8zhklGqXqXQk66JQXCFc1CLN5w8mGGPddQqqj4BR4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043