UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XdLmqAdQFoU68dSiVA+6Ev7dLvni8F06p8BGZlvp3kI='
WHERE
key_id = 'b749811d0934f3072d6325095ae9a34c35f6a759ccb6a030c58a2359d9b6838e'
AND (
token = 'XdLmqAdQFoU68dSiVA+6Ev7dLvni8F06p8BGZlvp3kI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)