UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fMnMoRB3Wy0umAxU10T3vGRDg+NYgb7K8EPPrdalMZc=' 
WHERE 
  key_id = 'ee93b4d2b1247c9845c281a7964e64dac79eb840605e8f83f4678885ad871715' 
  AND (
    token = 'fMnMoRB3Wy0umAxU10T3vGRDg+NYgb7K8EPPrdalMZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030