Hello, this is Emily.
How are these keyboards connected? Do you connected via USB port, or bluetooth?
If you've been using the same USB port for both keyboards you've tried, then try a different port, or try a bluetooth keyboard if possible, to see if that improves. I just want to make sure we are not dealing with a port issue. With internmittent issue like this, more often that not, it is a hardware issue instead of software issue.
If the same issue continues, I will recommend that you launch the computer into BIOS, and observe if the keyboard issue continues. If it continues, this is not a Windows issue, but a hardware issue, or potentially BIOS/firmware issue. You can go to the computer's manufacturer website, locate the model support, download and install BIOS to see if it helps. Or contact manufacturer support, as your computer is still covered under standard warranty.