UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'egs/htpr8O2Ruful6+wNlFJHBU+VaQXgfNHAxuHj8jk='
WHERE
key_id = '34374b55dfe42e9ab3fce93f5ed8f0e7d0071905cb153c25de454f172407bbed'
AND (
token = 'egs/htpr8O2Ruful6+wNlFJHBU+VaQXgfNHAxuHj8jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)