UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7lBSEnJaB49oQj3LR+WMOsCCX5MzNxMzDl4iX8yj80='
WHERE
key_id = 'a7c809204c96697d05db716d851c6e2faac117545de23e08826deb8260a0f756'
AND (
token = 'r7lBSEnJaB49oQj3LR+WMOsCCX5MzNxMzDl4iX8yj80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)