The over the counter WD-40 is a water dispersant and was not designed for long term corrosion protection.
However, in the WD-40 product line, they do have a WD-40 industrial product by the name of WD-40 Specialists Rust Inhibitor Lubricant that is for long term corrosion protection.
https://www.zoro.com/wd-40-specialis...35/i/G4477243/
Another great corrosion inhibitor is Hornaday One-Shot lubricant. Although it was designed for guns, it is a great long term corrosion protectant for metals.
https://www.cabelas.com/shop/en/horn...shot-case-lube