UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Q63B1LIDeKhQRmyZLZ1827XRPHSIiN8KuB9CjGVCTo='
WHERE
key_id = '7f3376ef9f93fd4ce3a19638add03d07bc3fbb4963c8882ca4a1cd6c3d968880'
AND (
token = '9Q63B1LIDeKhQRmyZLZ1827XRPHSIiN8KuB9CjGVCTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)