I am using 32 character long random alphanumeric strings as the cryptographic keys
First, I would suggest generating the keys differently. Cryptographic keys are not like passwords. There are specific requirements for the format of a cryptographic key, which depends on the algorithm.
In the case of AES, HMAC, and most other symmetric algorithms, the key should be a sequence of bytes (e.g. a byte[]
) from a cryptographically secure random number generator. Most programming languages have an easy way of doing this, e.g. you can generate a 32-byte key with os.urandom(32)
in Python or crypto.randomBytes(32)
in Node.js.
It's not strictly necessary to use this approach with HMAC; HMAC can accept keys that are not uniformly random. There are benefits, however, to doing things properly. First, it's simpler than using a custom password generator (and simpler means less opportunity for bugs). Second, it makes it easy to measure the security level of the key (e.g. a 128-bit random key by definition has 128 bits of entropy). Third, it's more secure: when used with a proper random key, it's sufficient if HMAC is a secure PRF. When used with a password-like key instead, the PRF assumption is not sufficient, and we must rely instead on proofs in the keyed random oracle model. Using HMAC with password-like keys invalidates the assumptions used in many commonly cited security proofs.
TL;DR use a CSPRNG to generate random bytes, and use those bytes as the HMAC key.
Now, how long should that key be? 32 bytes (256 bits) is long enough, and any longer than that probably isn't useful.
Generally, cryptographic systems target a 128-bit security level (100 bits is a rough upper bound on what the combined resources of the entire human race might be able to crack with a brute force attack in a year, which still leaves a comfortable security margin). NIST suggests that an $n$-bit key has an $n$-bit security level (with some caveats, see source, p.14), but I disagree with this assessment.
NIST's recommendation is only accurate when a system is considered in isolation. If an attacker has many possible targets (e.g. many different companies that are worth attacking), she may be able to use a multitarget attack to crack multiple keys simultaneously, or a few keys using far less effort. For example, if the attacker knows $m$ and $\text{HMAC}(k_i, m)$ for $i$ from $1$ to $2^{40}$, and the keys $k_i$ are 128 bits each, cracking one of those keys will take about $2^{128-40}=2^{88}$ operations, implying a security level of 88 bits!
It's straightforward to defend against this attack. If you want $n$-bit security, use $2n$-bit HMAC keys. Since a 128-bit security level is best practice, use 256-bit (32-byte) keys.