鍵をかけておけば、
When you locked the door in advance,
When you keep the door (being the "state" of ) "locked",
The expression is talking about the door being locked, the state, the situation.
鍵をかければ、どろぼうは入れなくなる。
When you lock the door,
The expression is talking about the "action" of locking the door.
It refers to the "change" from "unlocked" to "locked."