WD40 is a bomb in a can. It's highly flammable. I have never liked it. If you are after something along those lines look at LPS products. They actually make a dry film lubricant for electrical use that insulates from moisture. I am not advocating the use in electronic components until you have researched specific products.
https://www.itwprobrands.com/category-list-brand/lubricants/lps
https://www.itwprobrands.com/category-list-brand/lubricants/lps