When updating multiple rows with different values it is much quicker to use a bulk update.
UPDATE people
SET name =
(CASE id WHEN 1 THEN 'Karl'
WHEN 2 THEN 'Tom'
WHEN 3 THEN 'Mary'
END)
WHERE id IN (1,2,3);
By bulk updating only one query can be sent to the server instead of one query for each row to update. The cases should contain all possible parameters looked up in the WHERE
clause.