UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wJ6Ff/xPj93L0NPXsiA1NSmvxUN7OpGgOaunfWXTs0U='
WHERE
key_id = 'aaba61823dd31e6ead085cc6e6ab5e426a9037c31d7c7b94ab63216ed491c764'
AND (
token = 'wJ6Ff/xPj93L0NPXsiA1NSmvxUN7OpGgOaunfWXTs0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)