UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'psMf1Ku4pfM1BDhBNObK0e5ltW2aMRrKvs+/B0nW7vI='
WHERE
key_id = '8b3605a5fc04fb6240d363af63f40e673e302261a174a78c8569c479ebf92a12'
AND (
token = 'psMf1Ku4pfM1BDhBNObK0e5ltW2aMRrKvs+/B0nW7vI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)