UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zlY5VL2J+GPaU0Sf/4zEYnrO0ne3X4+9TJ5HGVnE9Oo='
WHERE
key_id = '8145f2338bc5043064004f6187f794e95095091f122f8d275ad0eb4d1b8e70e6'
AND (
token = 'zlY5VL2J+GPaU0Sf/4zEYnrO0ne3X4+9TJ5HGVnE9Oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)