Even an unjust law?
Sure. There are many remedies in our system for unjust laws: popular outrage at the outcome of a trial leading to the repeal of such laws by the legislatures, executive pardons for those convicted under such laws, even Jury Nullification (which should be required in jury advice by judges).
The entire sentencing process is about "doing justice", and is the main place a judge is given latitude - and juries. If the sentencing guidelines are worth anything, and the judge can balance all the elements of the conviction, then the application of those guidelines - part of the laws - will result in "justice".
Thanks for the comment, and I would recommend that if you believe that the personal emotions of the judge should figure into his decisions on the bench, then you should move to a Latin country where that is considered the norm. Maybe you think it's worked out well in those places, but I'd say the evidence doesn't support that.
PS - take lotsa cash. You're gonna need it.
If a law is unjust you can try getting out of it in this phase, as many people do.