UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gL7jt9PVMonJgcpZsu1eJab4IGx07vHQxNWG/rIAtLk='
WHERE
key_id = '817ee96eeef4d31b766b8dc887a67b35929c5827c75c9e0a20ff599e2e916e0f'
AND (
token = 'gL7jt9PVMonJgcpZsu1eJab4IGx07vHQxNWG/rIAtLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)