the characters are scripted, At a certain hour they will move to different positions, so the idea is to wait for it to happen and learn the routes of the guards like in the hitman games, so when the guard exits the room you can enter and pick the key and if he blocks your path, you rewind him to the room and continue.