Currently the server call is only avoided if keystate is locked (that is, if there are any related messages in the message queue). When the input is not locked GetKeyState() is supposed to sync thread input keystate with desktop and for that reason the call is performed.
The vast majority of time there are no such messages in queue and the thread input is the same as desktop input. Still GetKeyState is called the input is not locked essentially avoiding any optimization.
Tracking desktop input change serial number allows the client to detect if desktop keystate may be different from the thread input and call the server for input sync only when needed, which removes the majority of the server calls from GetKeyState().