How did Mari manage to pilot EVA Unit 02?
If you watched 2.22 you will see that the cores for Asuka and Mari were switched out before Mari took control of Unit-02.

Depending on the language, you csn hear in the background the crew rewriting Unit-02's access keys when Mari's gearing up to fight Zeruel. One assumes this has some bearing with how Mari is able to take control. 

There's no clear-cut canonical explanation of why but there are theories, one involving the time loop theory and Kyoko. But that's a topic for another question.