The "unable to lock database" or "failed to synchronize any databases" errors occur when your package manager thinks that there's already another instance of your package manager running on your computer.
Quite often this is actually not the case and the error is in fact just an error. And it can be fixed quite easily by deleting the database lock file.
To do this, open a terminal and execcute the following command:
sudo rm /var/lib/pacman/db.lck