UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4oMXy4K6oR1tb6FwQ1ZPdW3yen7Kpp3YwEebesiHfH0='
WHERE
key_id = 'af7ccfbdadc0b841ff355dc89ae96f5d315170d43c861beca4cd80ffe3696677'
AND (
token = '4oMXy4K6oR1tb6FwQ1ZPdW3yen7Kpp3YwEebesiHfH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)