Hang a floating mantel
If you use long enough lags to get a good bite into the stud, your first proposed method should be fine. If the "lever" action is high enough to snap a lag bolt, then it will be strong enough to snap the 2x3 as well. 

From a strength perspective, it doesn't matter how long the lag bolt is - the torque and shear at the junction of the wall/bracket interface is all that matters. It doesn't matter if the lag bolt sticks out 3" from the wall, or if just the bracket sticks out 3" from the wall. You get the same torque applied from the same downward force if you assume the lag/bracket/mantel assembly is one rigid body. And if it's not, then something internal in the shelf has already failed, and you don't need to worry about the torque loading on the lag at the wall.

If you wanted to use shorter lags for some reason, you could always countersink them by drilling into the 2x3 with a bit larger than the lag head.