UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sqZtYEyhe0OqzAt3Bp61wwlLuKliScGR4loluPFiLLs='
WHERE
key_id = '6f84aeecc6264103cbcde76370610464e9da907ef36e7c758e96b79364ac7fed'
AND (
token = 'sqZtYEyhe0OqzAt3Bp61wwlLuKliScGR4loluPFiLLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)