UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LJZ7qwJr7WYA7EbgiXkBr9GYdexChYw2cCA3K34DiLs='
WHERE
key_id = 'f1afe7f8363b5af8e769c52af009fab72212cd0fb778659ddc45a4aae5d553a2'
AND (
token = 'LJZ7qwJr7WYA7EbgiXkBr9GYdexChYw2cCA3K34DiLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)