Multiple update of records in the same table
Philᵀᴹ: Insert all of the data pairs into a temporary staging table, then run a single update. Will be lots quicker.

Kondybas: Create table pairs(id,name) from collected data and then:

UPDATE table 
JOIN pairs ON table.id=pairs.id
SET table.name=pairs.name


Wiki answer generated from comments on the question.