UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f3reuAfiCVcaKssH2B4qSHzJAd3/RrkiMQaEAL6V51A='
WHERE
key_id = '347bf1ef308050c7d88b0c72cfbc1478302bce91b406141d74be239abba8b9d5'
AND (
token = 'f3reuAfiCVcaKssH2B4qSHzJAd3/RrkiMQaEAL6V51A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)