I am going to implement a distributed application with multiple mobile clients and a web based server application. So each client and also the server are allowed to generate
There is no way to know for certain that they keys you are generating on the client are unique on the server DB until you communicate with the server.
If you communicate up front to the server, before creating any records on the client side, then you can reserve a range of keys on the server. For example, the server could hand out keys in batches of 10,000. The client communicates with the server, and reserves the start of the next batch of available keys, say 60,000. The client is then free to create records with ids from 60,000 to 69,999. Once the client runs out of keys, it needs to request a new range of keys. If all the clients and the server reserve keys for themselves like this, then all generated ids will be unique in the server's database.
Now if you create records on the client side before communicating with the server, then you would be stuck having to correct those ids once you get a reserved range from the server so that they are within that range, before you sync those records to the server.
I'm not sure why you are also trying to include a client id in the key; the server is assigning the high value, and this is enough to get unique keys generated on the client.