UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P9/KcjdiJp4X2kRs0DGLepaJT/4PviWigpkP+Uv5GwI=' 
WHERE 
  key_id = '081b2c1f449f35962aea09151b4b3202e3ceb189277d86638cc110cffd4a4e99' 
  AND (
    token = 'P9/KcjdiJp4X2kRs0DGLepaJT/4PviWigpkP+Uv5GwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035