UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0BB0UX5qKr6fTj99SvsIXO0n1Z9QewTxpRlcaRIYBVQ='
WHERE
key_id = 'c4f536cf64526bbfee53c0e9f26251b8016dea4faa411ca6ac41a95fc767569f'
AND (
token = '0BB0UX5qKr6fTj99SvsIXO0n1Z9QewTxpRlcaRIYBVQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)