UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6o19VuC5e+XvtDeM0Y4E13suiMT+VQZ+2mHe3/grwMA='
WHERE
key_id = 'a9ad70eb365f92ba18cfa583e70f501b47b189289e79fdb77a0e1d650bb38eb5'
AND (
token = '6o19VuC5e+XvtDeM0Y4E13suiMT+VQZ+2mHe3/grwMA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)