How to stay motivated in a group with low motivation?
Flee or fight.
Flee is obvious. Fight means focusing on your goals and finding something rewarding.
I've experienced low motivation, I am at this precise moment suffering high temperatures and lots of noise, the work environment is very important and it will have a toll in your productivity (and your career) if it is not the right one.
The point is, either you leave to a better place (if possible, that depends on several factors) or if you decide to stay then you need to compensate from that toxic environment.
I read some time ago a blog post titled hack your motivation, which could be useful. In general what I find most motivating is keeping track of my progress, on a daily or even hourly basis, either writing a section of a paper, running/conducting an experiment, programming some class or complex method, or anything else. Anything that gives you the feeling of making some progress.
That's probably why your colleagues are wasting their time, games provide some fictional reward, some fictional and imaginary sense of achievement, games are like porn in that sense (no real sex, only fiction and imagination). What I mean, in short is: gamify your research. You all will be playing games, but you will be playing the right one (assuming you do the gamification right).
This site is a good example of gamification. I have 2093 points already! I would feel less sick with some A/C, though...
What you have to ponder are your chances in this flee or fight scenario. I can't tell you whether you will have more success running to a less toxic environment or reducing the toxicity for you. It depends on the opportunities that you can find to flee and how strong is your motivation and gamification to fight toxicity.
That's your decision and yours alone.
Let' start with the obvious:
They play card games, computer online games
It is none of your business what they do on their PC, if they do not scream, yell or make noise. But even then, noise is also encountered on all working environments (even 2 students arguing about their research is enough to make another student not able to work). So, bring your headphones and shut them out.
...listen to songs with the loudspeakers on all the time.
If that bothers you, you must ask them (ask not tell) to stop. You have the right to not wanting to listen to their music. If they lower the volume, this is also a logical compromise. Again, bringing your headphones might help.
I do not know why they want to do a PhD, maybe they just want to delay the time joining the job market.
Probably they do not either. Still, it is not your business nor you are their supervisor to judge their performance. You must only be interested in YOUR performance.
My supervisor seems ok with it and does not get angry at their slow and boring progress.
Again, it is not your business what your supervisor does with his other students. Focus on yourself and your research problems.
You should realize that in any job (in or outside academia), not all people show the same dedication or have the same motivation towards their work. Some are slow unintentionally, others slack and many will just do the bare minimum not to get fired. Of course there are also many other who do their best, in order to be the best at what they do. It is always a matter of choice (and abilities) and people have different degrees of motivation and dedication. Again, you should not let others dictate what you do with your life or PHD and always imitate / get influenced by those that you look up to (hard working people) and not people you do not want to be like (like your PHD co-students). So, it is not clear why those playing games on their PC, influence how you do your work. On the other hand, if your working environment is notoriously bad, consider to:
Work some days per week from home if that is possible with your research and your supervisor is OK with that.
Come at office hours, where it is less crowded (e.g. earlier than other students)
Is there another shared office which you can use? Ask your supervisor about that but do it in a discrete way not to alienate yourself with the other co-students on a personal level.
Good luck