UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TZlN11xhkb5D94JiUgmbPd8nlSfWAF5pX/jV64gNg2M='
WHERE
key_id = '87aeba7e8d3356ba30b86f47fe360e607d9a2537a115e829645067ebc5a18f90'
AND (
token = 'TZlN11xhkb5D94JiUgmbPd8nlSfWAF5pX/jV64gNg2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)