UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIMy8vDwPKXXGy0UPjc8HCZi4kpgLmUekz8Fd0cMmTY='
WHERE
key_id = 'b6336569ddc6ed54e36ab4b4fa809772bbf3e6f53300658ba63eb7d25df23ac7'
AND (
token = 'kIMy8vDwPKXXGy0UPjc8HCZi4kpgLmUekz8Fd0cMmTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)