It depends on which of the two Pokemon the Magikarp defeats first.
If it defeats a Trevenant first, it will gain Attack EVs. But instead if it defeats a Sudowoodo first, it gets a Defense EV instead.
The EVs you gain from the Power Lens are added in after the other EVs are taken, and since in this case you can gain only one more useful EV, Power Lens will be discluded.
Hope I helped!