Trusting faith in Christ is a passive act, allowing God to save us. The thief on the cross wasn't. The woman caught in adultery wasn't. God chooses whom He will forgive. But baptism is not a work of righteousness designed to procure forgiveness.
Baptism is an act of trusting faith, gratitude, which is an outward expression of an inner reality.
Exactly when sins are forgiven is God's business. For our part, baptism in Jesus' name is commanded. I have done it. I teach others to do it. I'll leave it at that.