Getting WordPress database error Deadlock

Deadlocks happen mostly when you try to perform writes to the DB (trying to write more then one value at the same time to the same part of the DB). You specific code do not include any obvious writes so the problem comes from somewhere else.

From the statements that cause the errors it is possible to assume that you need to hunt for some code that deletes transients automatically.