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