Refactor update.c as well.

Mordernizing it and extract the functions to open the db and to update
user email, like the other tools.

Signed-off-by: Thiago Farina <tfarina@chromium.org>