UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lwNCrH01+HLMgIu+rWwANc9ph3EpP9gBzewUSGEzG+4='
WHERE
key_id = 'ecc6a2e9adc163916701a624601e04b1ea24da67aacda1a65c62cc17d8c2fd09'
AND (
token = 'lwNCrH01+HLMgIu+rWwANc9ph3EpP9gBzewUSGEzG+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)