Keyboards are like a maze with no clear way out. Most of times to solve an issue like yours it would be sufficient to replace the keyboard. It's a bit troublesome but it's feasable in a Mac like yours, it just takes time and about 25/30$ for the new keyboard. However there's still a small chance the issue comes from the logic board, but there's no way to tell unless you try a new keyboard or you can test your logic board in a Mac with a known good keyboard beforehand.