UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5RwTIrwRQirwU1bw4ybZ4jq2tzyfRM4qHHn0bjgEwZA='
WHERE
key_id = 'd3f505829e8367900cd118501d6610ef7dbac5d1ecab22ce9dec6326c3b75f92'
AND (
token = '5RwTIrwRQirwU1bw4ybZ4jq2tzyfRM4qHHn0bjgEwZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)