They do not attract dust. Dust seposition is governed by the laws of physics, which wd40/rp7 do not change.
Btw - the lock has that little slidey part /door to seal it off when there is no key inside - so dust cannot get in.
Graphite will not help with corrosion.

