Just that simple: If you want to defend yourself, don't lock up your guns except for certain occasions like a party.
You can't predict when bad guys come and, when they do come, you can't expect to be calm and rational. Your only chance is to have guns near-ready to shoot.
There are ways to ensure safety without locking guns up. If I live in a place where the law requires locking up, I would violate that law. No question about it. This kind of lawss are rarely enforced. Even if I got caught, it would be just a small fine. I'd consider the fine as the cost of gun ownership.