UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0O766U/6fg8ebi8ou3JYSQaaJhlniS2DZFDzt/K0RCM=' 
WHERE 
  key_id = '3f9fb73ead678d23707b67de7e3e254f6c83104445371d54d820d8059f73c12c' 
  AND (
    token = '0O766U/6fg8ebi8ou3JYSQaaJhlniS2DZFDzt/K0RCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035