You try to run a urpmi/rpm command and find out that your urpmi database is locked and don't know what to do. Here is a script you can execute to unlock it.

#!/bin/sh
   if [ -f /var/lib/urpmi/.LOCK ]; then
      rm -f /var/lib/urpmi/.LOCK
   fi
   if [ -f /var/lib/urpmi/.RPMLOCK ]; then
      rm -f /var/lib/urpmi/.RPMLOCK
   fi

Save the above code into a file called something like unlock.sh into a directory of your choice. Then perform the following command, as root, assuming you named the file unlock.sh

chmod +x unlock.sh

Then as root again from within the directory you saved the file perform the following command:

./unlock.sh

This should run the script and do what it needs to do to unlock your rpm/urpmi database.