You ask one guard which the other one would tell you would kill you. If you ask the one who tells the truth, he will be told that the safe door is the killer and will tell you that. If you ask the one who lies, he will be told that it's the one that kills so will tell you that it's the safe one. So you choose the one you're told will kill you.