I have the code for MySQL (perl):
UPDATE pages
SET rkey = rkey + 2,
lkey = IF(lkey >= $key, lkey + 2, lkey)
WHERE rkey >= $key
I
SQLite version 3.32.0 and newer support IIF.
iif(X,Y,Z)
The iif(X,Y,Z) function returns the value Y if X is true, and Z otherwise.
The iff(X,Y,Z) function is logically equivalent to and generates the same bytecode as the CASE expression "CASE WHEN X THEN Y ELSE Z END".
E.g.
UPDATE pages
SET rkey = rkey + 2,
lkey = IIF(lkey >= $key, lkey + 2, lkey)
WHERE rkey >= $key;