Place the mustard seeds into the glass jar. You are looking for them to fill about one-quarter of a 12- to 16-ounce glass Mason jar.
If using garlic, add the peeled and lightly smashed cloves to the jar.
Add the salt, sugar, and vinegar to a pot or small saucepan. Bring to a boil over medium-high heat. Reduce the heat and let simmer until the salt and sugar have dissolved.
Place the mustard seeds in a saucepot covered with cold water, bring to a boil, then strain the mustard seeds from the water using a sieve or fine mesh strainer. Add them to their glass jar.
Pour the liquid over the ingredients in the glass jar. Let cool to room temperature or until the jar is cool enough to handle (about 30 minutes) before adding the lid.
Serve or refrigerate for up to 2 weeks.