Check out example codes for "update using case in mysql". It will help you in understanding the concepts better.

Code Example 1

UPDATE `table` SET `uid` = CASE
    WHEN id = 1 THEN 2952
    WHEN id = 2 THEN 4925
    WHEN id = 3 THEN 1592
    ELSE `uid`
    END
WHERE id  in (1,2,3)

Learn ReactJs, React Native from akashmittal.com