setWorldPosition worx perfect for stuff like this and I doubt that you're clicking on the"invisible" lock
I see a multitude of potential issues in your screenshot.
First of all, the door. When you take your key to the lock on the left, you're not clicking on the keyhole, but on the clickable component of that door as the clickable component of the lock is probably behind it. you can disable this and check to see if it works.
Second, when placing locks like that, make sure you place them in front making them stick out towards the party.
Test if you can use it and then keep adjusting slightly the lock's position back into the wall until you can't access the clickable component of the lock by mouse clicks. If you move it too far into the wall like on the screenshot it will never be clickable in the first place.
So what I think what's happening is that you're simply opening the door by clicking on the door which is a possibility with that specific door as it's the swinging door with opening/closing animation.
I hope you understand what I'm trying to explain
I have developed many workarounds myself in these types of situations in my own mod.
Just place the lock to the left like you did, but make it float in the air in front of the door and then slowly adjust values and see how far you can place it into the wall before the clickable component of the lock is blocked. And that's the position where you can offset your lock.clickable component thing.
Or just do what Isaac told you. Which is basically the short version of my long post.