I had a similar problem.
I had a wireless cheap controller plugged in and it bugged out some games when i used keyboard/mouse.
I just removed it completely or took it out and put it back in.
I guess some driver issues.
If it's not that try replugging your keyboard (both before and mid-game)
Keep in mind it was the wireless controller for me, for you it can be anything else...
I had a similar problem. I had a wireless cheap controller plugged in and it bugged out some games when i used keyboard/mouse. I just removed it completely or took it out and put it back in. I guess some driver issues.
If it's not that try replugging your keyboard (both before and mid-game)
Keep in mind it was the wireless controller for me, for you it can be anything else...