The pin cylinder -- the part that recognizes the key, bored shell and plug with pins and springs -- is typically brass and so does not tarnish significantly in any but the worst conditions. It may or may not have a dry lubricant applied to it, either graphite (traditional) or more recently a PTFE "dust" lube (some of which apply as a liquid but the carrier evaporates away). The cylinder can experience wear, but it generally takes a significant amount of time, and some of that is unavoidable and simply requires rekeying when the wear gets serious enough to affect performance. If a lock starts behaving like it's sticking, LIGHTLY adding more graphite or teflon dust (a "puff", not a pile!) may help.
The latch mechanism (the part that actually holds the door closed) is often steel, and may be given a light coat of grease to protect it. Since these are large parts, they don't often seize, but they too can wear out eventually.