UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '32/8r5NlK7WklewgOgvt2VnqYXa6YVm2xkHXLLxRWQQ='
WHERE
key_id = 'ca4d497844b7f6ab11443534940ff589f5ea6f1f09e6a2019dae1b5472351a4c'
AND (
token = '32/8r5NlK7WklewgOgvt2VnqYXa6YVm2xkHXLLxRWQQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)