UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BUY083zXUSunRPoC3glwxwcj8tyS8ljKwswb5AWu4DU='
WHERE
key_id = '8ad1e28567e0a7bea388aa1454d415fbd4b6522ccae7fa0bab7caa0bb2ebee01'
AND (
token = 'BUY083zXUSunRPoC3glwxwcj8tyS8ljKwswb5AWu4DU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)