I tend to think HW rather than SW. If it were me I would remove the key board, shake it upside down and work the keys in that position while puffing with dust off periodically from various angles.
Probably good to shoot some dust off into the USB connectors - perhaps change the connector used in the computer, and consider using some shaped stiff card stock covered by a bit of old white T shirt slightly wet and then dry (or with some 99% (or at least 90% no lanolin) isopropyl alcohol) to clean the inside of the connector finishing with a dry rub and dust off.
Might also be a good time to badblock the disk if appropriate (that is - if it is not SSD).
Virus root kit scan. Possible system re-load. If still no joy consider replacement.