I am experiencing this exact issue, so I will just add my own details. I think it's worth noting that I've been using the Spotify desktop client since January this year, and the volume/mute keys on my keyboard have been working up until a day or two ago. (Again, they work when Spotify is not the active window.)
Details:
Spotify Premium
Windows 7 64-bit
Generic Dell keyboard (flat keys, has numpad, I don't know the model number)
Not using a laptop, can provide PC specs if needed
I've been getting this since a recent update as well
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game…