As a rule, a CTE will NEVER improve performance. A CTE is essentially a disposable view. There are no additional statistics stored, no indexes, etc. It functions as a shorthand for a subquery. In my opinion they can be EASILY overused (I see a lot of overuse in code in my job).
Check the cupcakes at the minimum baking time. If the recommended baking time is 18-22 minutes, check them at 17 or 18 minutes (just a quick peek, make sure not to let too much heat out of the oven). If the tops are rounded and no long appear wet, they may be done.
Bake the cupcakes at the same temperature called for in the cake recipe, but reduce the baking time by one-third to one-half (cupcakes usually bake for 15-20 minutes). Check doneness by inserting a wooden toothpick into the center of the cupcake. If the toothpick comes out clean, the cupcakes are done. If the toothpick comes out with moist crumbs on it, bake the cupcakes for a few more minutes. Let cupcakes cool in the pan for 5-10 minutes, then remove and cool completely on a wire rack.