UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lminjAa9P456NSfs8jHFn+d81uPwxcP1k+W1jXJU4bQ='
WHERE
key_id = 'bac1e43b7a4e9e7289a9ccd8404c38097cb029a164936ed49914f744fefabc50'
AND (
token = 'lminjAa9P456NSfs8jHFn+d81uPwxcP1k+W1jXJU4bQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)