UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fm6A/dWLeXy9kYYNlcEoZO8JO5pyprPNkClXw0Wchg4=' 
WHERE 
  key_id = '112bf5a970886bf9b078128f429b29f56f209e37dbe218ccf20d356636cc7f80' 
  AND (
    token = 'Fm6A/dWLeXy9kYYNlcEoZO8JO5pyprPNkClXw0Wchg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037