To Fix iOS 11.3.1 Cydia dpkg_locked error, You don’t need to restart/re-jailbreak.
Use the following commands to fix the error of dkpg_locked.
We will move dkpg folder from /Library to /Private/var/lib/ to fix the dkpg_locked error in Cydia on jailborken iOS 11.3.1
mv /Library/dkpg /Private/var/lib/
Then simply reload Cydia and it should now ask you to upgrade essential or complete and you’re done.