Jailbreak an officially unlocked iPhone
It won't affect the unlock.  A legitimate (ie sanctioned by the carrier and not hardware/software) unlock happens at the carrier level and jailbreaking doesn't affect that.