tl;dr: The Flash episode S01E22 takes place concurrently with the events of Arrow S03E23, with the Arrow episode happening entirely "during" the Flash episode.
Though the timelines of the two shows got out of sync for a while, it's pretty clear based on the dialog that Flash has caught back up to Arrow, and the episodes for the week in question are happening concurrently. There are some complications in this theory that are difficult, though not impossible, to explain away. Overall, though, I think it's the only explanation that's at all realistic.
Early in the episode, Barry tells Joe that he couldn't get in touch with Oliver directly, because he was in Nanda Parbat, and the only person he could get in touch with is Lyla. At this point, Barry doesn't appear to know what or where Nanda Parbat is, only that Oliver and most of his team are there. This lines up with where Oliver was, and who was with him (i.e., not Lyla), at the end of Arrow's episode, S03E22. This is also where S03E23 picks up immediately afterward, with Oliver having just left Nanbda Parbat.
Sometime after his conversation with Joe, Oliver gets a message to Barry (completely off-screen), asking him to
come to Nanda Parbat (see on Arrow E03S23) and rescue the Arrow team.
This is the part that gives us the most problems, since it's unclear when Oliver could have done this. It's unlikely that he got in touch with Barry while he was in Starling City
hunting Nyssa, since it would have blown his cover,
and would also mean that The Flash S03E22 must span multiple Arrow episodes. And once he was back in Nanda Parbat, he's had no chance to contact the outside world except through Malcolm Merlyn. We have to assume, then, that at some point off-screen, Malcom got in touch with The Flash and passed along Oliver's message. This explanation has some rough spots, particularly why Barry would trust a "super villain", or how Malcolm even found him, but it's about the only explanation that fits the facts.
Regardless of how Barry gets the message, he does appear in the beginning of Arrow S03E23. While there, he says that needs to have "a long overdue conversation with Harrison Wells." He could be saying that he has Wells in custody, and wants to go interrogate him, but that completely destroys the continuity between the episodes. We have to assume that's not what he means, or else the whole question of timing become unanswerable.
The other way to interpret that statement is that he's speaking metaphorically about confronting Wells and demanding answers, meaning that when Barry appears on Arrow, we are still in the early part of The Flash S01E22 timeline. This makes his choice of phrase a bit odd -- why not just say "I have to go find Dr. Wells" if that's what he meant? But, again, I think we have to assume that's what he meant, because it's the only way the pieces all fit together.
After that conversation, Barry and Oliver go their separate ways. The Flash and Arrow episodes then proceed along their respective timelines. Once the events of Arrow are finished and the episode is wrapping up, Oliver is no longer under any constraints to keep pretending to be evil. He's now free to travel to Central City (in his new outfit) and assist Barry, and take
Ray's anti-speedster nanotech with him.
While there, Oliver tells Barry that he might "need a favor" from him. This is obviously an intentionally vague statement that's probably setting up future cross-overs, but it also fits in pretty cleanly with the condition of Oliver and his various team members at the end of Arrow Season 3.
See also my timeline of the two shows and their crossovers in this question:
In what order should I watch Flash and Arrow TV Shows?