Sometimes USB problems like this can be related to motherboard BIOS settings. The fact that it only affects keyboards is a hint that the BIOS's USB keyboard support could be giving you trouble.
On your specific motherboard there are three settings that can affect USB keyboard functionality.
Legacy USB Support
Enable or disable Legacy OS Support for USB 2.0 devices. If you encounter USB compatibility issues it is recommended to disable legacy USB support. Select UEFI Setup Only to support USB devices under the UEFI setup and Windows/Linux operating systems only.
You should turn this setting off if you're using Windows 10. On some motherboards this may disable USB keyboard support in your BIOS though. It helps to have a PS/2 keyboard for configuring a BIOS in those situations.
PS/2 Simulator
Enable the support of I/O port 60h/64h emulation. This should be enabled for the complete USB keyboard legacy support for non-USB aware OSes.
You should turn this setting off if you're not using the "Legacy USB Support" option above.
XHCI Hand-off
This is a workaround for OSes without XHCI hand-off support. The XHCI ownership change should be claimed by XHCI driver.
You should turn this setting on if you're using Windows 10.
This setting basically allows the USB controllers on your motherboard to be directly controlled by the operating system & drivers. When the setting is off, the BIOS will retain ownership of the USB controllers even after booting and exposes USB functionality to the operating system differently. On Skylake CPUs and later this setting is must be on for USB 3.0 support.