UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'raKTicdUPMAplww2sd0xlNweSJzjboYfad7M2e/t9b8=' 
WHERE 
  key_id = 'd9c89ff092cfacd72974710eb93716e4e2177d0dad9d51f37024eb2d1096d783' 
  AND (
    token = 'raKTicdUPMAplww2sd0xlNweSJzjboYfad7M2e/t9b8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047