You must take only Box A.

If you take both boxes, then it will simply turn out that Box A is empty.

To stubbornly claim that your decision is uncorrelated with other events in the multiverse shows that you don't yet regard yourself as a physical mechanism. Face the fact that your decisions are by necessity totally correlated with many other events in spacetime.

True, as you gaze at the padlocked boxes, and note the days-old layers of dust on them, you may be under the illusion that the thought processes that finally obtain in your own brain are totally independent of what has happened elsewhere, and are totally independent of the contents of the boxes.    But they're not.    We have every rational right to regard a single slice of spacetime as virtually deterministic, and that your decision is completely consistent with all physics within the solar system.

You may also erroneously think "I cannot change what's in the boxes." This is just the wrong way to look at it. You don't know what's in the boxes. While it is not a question of "changing" anything, it is a question of causing (from your perspective) the contents to be one thing or to be a different thing.

Admittedly, it is a bit weird to affect something formally in the past, but the whole contrived situation is of course weird. Besides, we must get used to much weirder things than this, as you probably already know.

(It turns out to be a little easier, given the fact of the existence of the multiverse, to explain why this answer is correct.)