UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aEgUUgcvOVMkHrHKJMuvtaN7FIV3mzStgO3hA+CmBsg='
WHERE
key_id = '3c390ae83c457842a131d61d9bb1c74a26568c33a8d3b4833ded09c274951959'
AND (
token = 'aEgUUgcvOVMkHrHKJMuvtaN7FIV3mzStgO3hA+CmBsg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)