I believe this is Last Day on Mars (2017) by Kevin Emerson, the first book in the Chronicle of the Dark Star series.
From a review:
All remaining humans are leaving Mars for a distant planet, but departure day goes sideways.
The “burning husk” of Earth fell into the sun five years ago, and Mars is about to become uninhabitable. The Scorpius leaves today with the last 100 million passengers. Thirteen-year-old Liam’s sad to go: he was born on Mars and identifies as a Martian, unconcerned that his Earth heritage is “Thai, Irish, Nigerian, Texan, and like ten more.” His parents and his friend Phoebe’s parents are rushing the final research for terraforming their destination planet when a radioactive explosion, complete with mushroom cloud, blows the lab to bits. The Scorpius departs with Liam’s sister and the 100 million aboard, leaving Liam, Phoebe, and a highly skilled robot functionally alone (their parents are alive but unconscious)—can they catch the Scorpius? Emerson’s story is fast, exciting, and terrifying, involving spacecraft of many sizes, travel through space, more explosions, an alien gadget that shows Liam the near future (and that extraterrestrials exist! Humans hadn’t known), and some shadowy characters. Who’s the blue ET chronologist murdered in Scene 1? Who’s trying to exterminate humankind, and why? How many unrelated ET groups are out there? A stunning reveal at the end will leave readers gasping for the next installment.
From a Goodreads user review:
It was a bit of slow starter for me but once it took off I was hooked. Liam and Phoebe are in way over their heads as all of humanity is racing the clock to get off of Mars before "red line" hour arrives. I love the action and the mystery surrounding the "watch" that Liam finds adds whole new dimension (literally) to the story. Lucky me that the second book is scheduled to be released next month!