UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gaIZFQbyOeEVeE1VTR9O2SBXbTkQtDe4gaANKmjf2Yc=' 
WHERE 
  key_id = '1ac76373dc0d2bedb96bd736aefaf0d18c1f62968ce873cfd8455cbb88e0cded' 
  AND (
    token = 'gaIZFQbyOeEVeE1VTR9O2SBXbTkQtDe4gaANKmjf2Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016