Most of time we need to update multiple row at a time or in single mysql query, So most of developer use iterate the update query and execute many time. This is not good practice. We should use syntax given as below.
SET cod_user = (case when user_role = 'student' then '622057'
when user_role = 'assistant' then '2913659'
when user_role = 'admin' then '6160230'
date = '12082014'
WHERE user_role in ('student', 'assistant', 'admin') AND
cod_office = '17389551';