UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N9ju8BNSlpN0O9hKLoOTSRXjSx+p5mdtiX+fM5sQSDk='
WHERE
key_id = 'f11715c3bddf578c301f00ab1659b781e525df6751d02dc60bc8613046873f12'
AND (
token = 'N9ju8BNSlpN0O9hKLoOTSRXjSx+p5mdtiX+fM5sQSDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)