UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KHu38MKUHPeeaDGULlBJbV/o4e56mI9s9hx0h1+ybb4='
WHERE
key_id = 'd9b6552f39e714cea7b21eca1fe4651bb9696603b970bd51de81cc2d0273e541'
AND (
token = 'KHu38MKUHPeeaDGULlBJbV/o4e56mI9s9hx0h1+ybb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)