One highly unlikely, but occasionally possible, cause for this error is if having added the same key twice with different expiry dates. You would likely know having done so for this answer to be relevant to you.
This can happen, as it did for me, when hosting your own repository with your own keys. If you, when the key is about to expire, simply extend its lifetime rather than change it, and if you installed the original key using preseeding but the updated key using a deb package, then the old key will be in /etc/apt/trusted.gpg, while the new one ends up as a separate file under /etc/apt/trusted.gpg.d/. The old key will shadow the new one, which will be completely ignored by apt-key. Remove the old key by running gpg --keyring /etc/apt/trusted.gpg --delete-keys <keyid>, and your new key will become detected.
This is a bit of a non-standard corner configuration, but I hope my answer can save some confusion in case anyone else encounters this issue due to the same reason as I did.
for K in $(apt-key list | grep expired | cut -d'/' -f2 | cut -d' ' -f1); do sudo apt-key adv --recv-keys --keyserver keys.gnupg.net $K; done– ryanpcmcquen Dec 11 '16 at 00:47keys.gnupg.netmight be no longer available because it works only with old version of the operating system, this host which serves GPG keys needs to be updated in this answer. – Ham Feb 20 '23 at 04:11keys.gnupg.netgone and no longer available, and you can switch to any other key server, there is nothing to do with old versions of operating system, I submitted my change to this answer please take a look, thanks – Ham Feb 22 '23 at 07:10