Cant update packages

Yesterday I got a notification to update the packages. I have around 177 updates to update. I tried to update from the GUI, and it first completed the download, and it was stuck there. It just stopped after downloading 842.12/842.12, and it never moved. Then I closed and restarted the laptop. Then it stucked at checking inter-conflicts, then I typed the command sudo rm /var/lib/pacman/db.lck. Then reopened it. No change. Then I was unable to close it and I killed the process from the system monitor. And after that, it stuck at waiting for another package manager to quit. I fed up and went to bed. Today I tried to update, and it is showing the same thing, Checking for inter conflicts.
I even tried updating from the terminal and showed me this error. I typed pacman -Syyu then it showed me :: Synchronizing package databases... Error: failed to synchronize all databases (unable to lock database)
I tried upgrading and it showed me this error again
error: failed to init transaction (unable to lock database) error: could not lock database: File exists if you're sure a package manager is not already running, you can remove /var/lib/pacman/db.lck

Edit: I tried to update once again and as always it stucked at inter conflicts and I waited for around 1 hour and I got a popup to restart the computer. And then I checked the pamac, and it told me that all my packages are updated. I have no idea how this happened. I did nothing.

sudo rm -f /var/lib/pacman/db.lck
sudo pacman-mirrors -f 5
pamac update