I suspect the difference is whether (as with the old door lock) there is no lubricant at all and anything is better than nothing, or whether (as with the ignition key) there is a lubricant there which was designed for the purpose but for some other reason isn't working as intended, and which the WD-40 will displace and replace with something worse. "Fails in hot weather" sounds either like some sort of thermal expansion problem or the intended grease gets too thin to properly lubricate a high-pressure contact area. Or there just isn't enough of it.
You're not supposed to use lube on locks because the film strength of the oil will be enough to make tight pins that have tiny clearances not move.
Not really applicable in an automotive lock which start out as hotdog down hallway when new and only expand from there.