Hi Marcos,
according to your description, I do NOT think that it is due to the key contacts. As already described above, it could be due to the Key Scanner IC (which queries the key contacts) or to the Key Matrix (a diode matrix via which the key contacts are connected to the Key Scanner IC).
The only thing you could do yourself, in my opinion, is to check all the ribbon cables / multi pin connectors near the circuit boards "MK76L", "MKC", "MKH" and "EMKS" (for a simple "contact problem" to be excluded).
And please be very careful when cleaning the key contacts and the rubber contacts. I do NOT recommend to use "WD-40"! Such oily products should NOT be used for electronic devices. If you damage the carbon layer of the contacts on the circuit boards or on the rubber strips, a further repair will certainly be very expensive.
Unfortunately, due to your description, I have no better news for you. This is probably a case for a service technician who is familiar with Yamaha keyboards.
P.S.
To narrow the problem down a bit, you could connect an external MIDI keyboard to the T5:
Select the MIDI template "All Parts" on the T5 and connect the MIDI keyboard to "MIDI B IN". Set the transmission channel of the external keyboard to CH 1. If everything works normally in connection with the external keyboard, the problem is at least limited to the internal keyboard (and thus truly to the mentioned sources of error "Key Scanner IC" or "Key Matrix").
Best regards.
Chris