UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TMylq4t4dyNSyqcwPP0avTuMrPQz3yb5Ew3h3hI8/78='
WHERE
key_id = '417008e9e44c7f7bb0c298bd671fca013ad3abbd58998e3dd18ea76997113db8'
AND (
token = 'TMylq4t4dyNSyqcwPP0avTuMrPQz3yb5Ew3h3hI8/78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)