There's a common statement made often by trainers in this regard: under stress in the real deal, you will only be as good as 50% of your typical day in training.
Training and running drills distills the muscle-memory into your arms, fingers, legs, etc. This muscle memory is what will typically default to under stress. Keep in mind you lose all fine motor control when under serious stress. If you train regularly, expect your training results to be to get worse by a factor of 1/2 in the real deal (it's not a perfect science, this is just what is typically quoted). This means hand-palm size groupings will roughly double in size.
Knowing some of the above, you adjust how you train to fit those common rules and guidelines. When your training reaches a level where you are near perfect, then you start adding stress (in the ways mentioned in some of the other posts) to the training, and repeat until that level of training reaches a reasonable level of perfection as well.
There are quite a few shooting schools you can go to, that will do this. And over time, you will better your abilities with self-defense and weapons. Shooting is a perishable skill, so it's particularly important you maintain a level of ability consistently.