UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tQ5P2thcBe/TGWM3fo2JT5crB1mrCfuqGQNW5SQjj4Y=' 
WHERE 
  key_id = '3871e0f6edde16c29ce105d518b7bc8bfec706125a1bded10b3207be7186740b' 
  AND (
    token = 'tQ5P2thcBe/TGWM3fo2JT5crB1mrCfuqGQNW5SQjj4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030