the unlock should only happen in case it was actually locked by that process, and it should happen in an atomic way. Therefore using this LUA script