If we must choose, we should choose to colonize Mars. Statistically speaking, an asteroid impact is inevitable. Time is the relevant variable. The sooner humanity can be a multi-world species, the sooner we are more robust against that threat. The same will be true of our successors who will necessarily have less time than we to spread from Earth. If we manage to spread to other worlds and Earth is destroyed, we will still be around to develop our successors (and will also have a leg up on spreading to ever more worlds). If we manage to create our successors and the Earth is destroyed before we get to other worlds, it's game over.
The relative habitability of Earth and Mars may actually have a converse effect on the survival of a technological civilization. On Mars, such a civilization would be necessary for continued individual survival for what may be geological time scales. On a recovering Earth, humans may salvage civilization, devolve into a new and indefinite dark ages, or give up on civilization entirely and the species will still go on.