Cleanup locks after releasing

This adds a little more logic to the SQLDB locks, allowing them to cleanup after themselves upon releasing.
They will grab another lock before deleting to ensure that a chance is given to someone waiting for the lock to grab it. Deletion is not retried since it's assumed that the next owner of the lock will delete it later.