UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y5EsKo390m56EsOLpRXv/kW77YklBTTFPNePuNDd6u0=' 
WHERE 
  key_id = '9f54cad467fe1e9b0365e9ad3bb7cc5f9c88099a037b23de9f0c7d2b4ffcf19b' 
  AND (
    token = 'y5EsKo390m56EsOLpRXv/kW77YklBTTFPNePuNDd6u0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037