Toast mustard seeds, coriander seeds, and peppercorns in a medium saucepan over medium heat until fragrant, about 2 minutes. Add vinegar, water, salt, and sugar and bring to a rapid simmer. Meanwhile, place carrots and shallot in a 1-quart heatproof container with a tightfitting lid.
Once the vinegar mixture simmers, pour over vegetables, making sure to cover them completely. Allow mixture to come to room temperature, about 1 hour, then cover. Store in the refrigerator for at least 12 hours before using.