UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iTFQWkj5U+QE1OaTewrFpLnehM36yGatpPx5BhGlqGk='
WHERE
key_id = 'a7617a671c65fe619014d5387f484eeb8cd334431020df56a266151c9a2e8ee2'
AND (
token = 'iTFQWkj5U+QE1OaTewrFpLnehM36yGatpPx5BhGlqGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)