UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qh+ONeu6hjYHpgoyJ5nCfYPMeF95BhwReDrsfX+bBAY='
WHERE
key_id = '8ff220cfa06e10d4295c286063f3f200e9b8d241e588f504053fc2d97ba2a635'
AND (
token = 'Qh+ONeu6hjYHpgoyJ5nCfYPMeF95BhwReDrsfX+bBAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)