UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S+ech4OCGVf9zqO+x0suxowWVcsWXaJCrveNNpEoAKw=' 
WHERE 
  key_id = 'f8bdd4723cc3518f85fc43999e90204be030d99ef2e7a64050332ddfae2338dd' 
  AND (
    token = 'S+ech4OCGVf9zqO+x0suxowWVcsWXaJCrveNNpEoAKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039