UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Mw8D3iJP7hhD6Lc14qS502qrmM1OHqxB4IEQ7MPrus='
WHERE
key_id = '0c840faf350eeea5a536ab625d15f6a92e317c364041fae730c1970f8cbb03d2'
AND (
token = '9Mw8D3iJP7hhD6Lc14qS502qrmM1OHqxB4IEQ7MPrus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)