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

Query time 0.00023