'Is MySQL `IF` statement atomic?

Assuming the multiple applications use this statement to assure exclusivity with MySQL Locking Functions

SELECT IF(IS_USED_LOCK(:name) = CONNECTION_ID(), -1, GET_LOCK(:name, 0))

I'm wondering whether the IF statement is atomic (can it happen that lock gets acquired multiple times)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source