it's not clear what would cause the time delay, seems like a timeout after a deadlock of some kind. however first thing is that your async code is written incorrectly, as it is sharing the same AsyncSession among two concurrent async tasks, which will cause random errors at any number of levels (ORM Session, Core connection, asyncpg connection) and is likely to be related to your issue.
for your async.gather(), each task should receive (or create on its own) a separate AsyncSession that's independent of the other, and each AsyncSession should proceed on its own connection/transaction. You can't do concurrent work within a single transaction even with an asyncpg connection.